feat(vnext): correlate completion refresh intent - #198
Merged
Conversation
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Light2Dark
marked this pull request as ready for review
July 25, 2026 17:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AbortSignalhandling against reentrant and throwing getters/listener methods without allowing an older invocation to erase newer workWhy
The upcoming CodeMirror adapter must refresh completion only for the request that originally produced a loading result. Revision checks alone cannot distinguish multiple requests at the same document revision, and asynchronous token publication leaves a race where catalog events can arrive before the consumer knows what to match. This contract makes that identity explicit and keeps latest-request-wins behavior correct across hostile caller boundaries.
Validation
a0522c4Summary by cubic
Adds an opaque completion refresh token to correlate loading results, follow-up catalog events, and the originating request.
session.complete()now returns aSqlCompletionTaskthat exposes the token synchronously, andonDidChangeevents include the token when relevant.New Features
SqlCompletionRefreshTokenandSqlCompletionTask(complete()returns a task withrefreshToken).SqlSessionChangeEventnow carriesrefreshToken:catalog-availability: always includes the exact token for the active soft intent.catalog: includes the matching token during an active intent lease, otherwisenull.provider-configuration:refreshTokenis alwaysnull.refreshTokenwhen acatalog-loadinglease is active; otherwisenull.AbortSignaland timer handling to avoid reentrancy issues and prevent stale callbacks from erasing newer work.Migration
const task = session.complete(...); const result = await task;task.refreshTokenimmediately to latch intent.onDidChangelisteners:event.refreshTokento the latchedtask.refreshTokenbefore refreshing.catalogevents withrefreshToken: nullas unrelated to the current intent.complete()now returnsSqlCompletionTask(still awaitable).SqlSessionChangeEventunion with per-reasonrefreshTokensemantics.Written for commit a0522c4. Summary will update on new commits.